/*
 * $LastChangedDate: 2007-06-11 18:44:02 +0200 (Mon, 11 Jun 2007) $
 * $LastChangedRevision: 185 $
 * $LastChangedBy: david $
 */


#include "Log.h"

#include <iostream>
using namespace std;

int Log::loglevel = Log::INIT | Log::CONNECTION | Log::IO | Log::LOCK;


Log::Log()
{
	/* nop */
}

Log::~Log()
{
	/* nop */
}

bool Log::isEnabled(int lvl)
{
	if (loglevel & lvl) {
		return true;
	}
	return false;
}

void Log::println(Client & cl, std::string s)
{
	cout << cl.id << ": " << s << endl;
}

void Log::println(Client & cl, std::string s, int logtype)
{
	if (isEnabled(logtype)) {
		println(cl, s);
	}
}

void Log::println(Server & sv, std::string s)
{
	cout << "Server: " << s << endl;
}

void Log::println(Server & sv, std::string s, int logtype)
{
	if (isEnabled(logtype)) {
		println(sv, s);
	}
}

void Log::println(FileMngr & fm, std::string s)
{
	cout << fm.id << ": " << s << endl;
}

void Log::println(FileMngr & fm, std::string s, int logtype)
{
	if (isEnabled(logtype)) {
		println(fm, s);
	}
}
